package com.topnav.mc.admin.dao.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.topnav.mc.admin.entity.bean.SiteBean;
import com.topnav.mc.admin.entity.param.SiteParam;
import com.topnav.mc.base.mc.McMapper;
import org.apache.ibatis.annotations.Mapper;
import com.topnav.mc.admin.entity.Site;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface SiteMapper extends McMapper<Site, SiteBean, SiteParam> {
    String commSql = " SELECT s.*," +
            " o.code AS orgCode, o.name AS orgName, o.short_name AS shortName, o.path " +
            " FROM mc_site s " +
            " LEFT JOIN mc_organization o ON s.org_id = o.id " +
            " ${ew.customSqlSegment}";


    @Select(commSql)
    SiteBean selectInfoOne(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    List<SiteBean> selectInfoList(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    Page<SiteBean> selectInfoPage(Page<SiteParam> page, @Param(Constants.WRAPPER) Wrapper queryWrapper);
}
